<template>
<div id="">
  <button class="btn btn-success" @click="chenge(1)">组件1</button>
  <button class="btn btn-success" @click="chenge(2)">组件2</button>
  <p :is="currentCom"></p>
</div>
</template>
<script>
import Child1 from '@/page/com/isChild1'
import Child2 from '@/page/com/isChild2'
export default {
  methods: {
    chenge(index) {
      if (index == 1) {
        this.currentCom = "Child1"
      } else {
        this.currentCom = "Child2"
      }
    }
  },
  data() {
    return {
      currentCom: "Child1"
    }
  },
  components: {
    Child1,
    Child2
  }
}
</script>
<style scoped>
</style>
